package study.spring;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class StudyController {

	@RequestMapping("/hello")
	public String hello(@RequestParam String msg, Model model) {
		model.addAttribute("msg", msg);
		System.out.println(msg);
		return "hello";
	}
	
	@RequestMapping("/hello2")
	public void hello2(@RequestParam String msg2, Model model) {
		model.addAttribute("msg2", msg2);
		System.out.println("second msg : " + msg2);
	}
	
	@RequestMapping("/hello3")
	public ModelAndView hello3(@RequestParam String msg3, Model model) {
		model.addAttribute("msg3", msg3);
		return new ModelAndView("hello3");
	}
}
